power of a matrix using cayley Hamilton